﻿using MB.RuleBase.Common;
using Model;
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Linq;
using System.Text;
using WoChu.Autorun.Base.Model;
using WoChu.Autorun.Base.Util;

namespace WoChu.Autorun.Base.Dao
{
    [ConfigFileName("WCS_WMS")]
    public class WCS_WMSDao :Dao
    {


        public List<T> Query<T>(string sql)
        {
            try
            {
                return DatabaseExecuteHelper.NewInstance.GetObjects<T>(null, typeof(T), sql, null);
            }
            catch (Exception ex)
            {
                MB.Util.TraceEx.Write(ex.Message);
                return null;
            }

        }
        //获取未完成的WCS_TO_WMS表信息
        public List<WCS_TO_WMS> GetWCS_TO_WMSlist()
        {
            try
            {
                return DatabaseExcuteByXmlHelper.NewInstance.GetObjectsByXml<WCS_TO_WMS>(ConfigFileName, "GetWCS_TO_WMS");
            }
            catch (Exception ex)
            {
                MB.Util.TraceEx.Write(ex.Message);
                if (ex.Message.Contains("ORA-03135"))
                {
                    return DatabaseExcuteByXmlHelper.NewInstance.GetObjectsByXml<WCS_TO_WMS>(ConfigFileName, "GetWCS_TO_WMS");
                }
                return null;
            }
        }
        //根据订单编号获取WCS WMS反馈信息
        public List<WCS_TO_WMS> GetWCS_TO_WMSlist(string ORDERNO)
        {
            try
            {
                return DatabaseExcuteByXmlHelper.NewInstance.GetObjectsByXml<WCS_TO_WMS>(ConfigFileName, "GetWCS_TO_WMSlistByOrderNOwithoutflag", ORDERNO);
            }
            catch (Exception ex)
            {
                MB.Util.TraceEx.Write(ex.Message);
                if (ex.Message.Contains("ORA-03135"))
                {
                    return DatabaseExcuteByXmlHelper.NewInstance.GetObjectsByXml<WCS_TO_WMS>(ConfigFileName, "GetWCS_TO_WMSlistByOrderNOwithoutflag", ORDERNO);
                }
                return null;
            }
        }
        //根据订单编号和状态获取WCS WMS反馈信息
        public List<WCS_TO_WMS> GetWCS_TO_WMSlist(string ORDERNO, int FLAG = 0)
        {
            try
            {
                return DatabaseExcuteByXmlHelper.NewInstance.GetObjectsByXml<WCS_TO_WMS>(ConfigFileName, "GetWCS_TO_WMSlistByOrderNO", FLAG, ORDERNO);
            }
            catch (Exception ex)
            {
                MB.Util.TraceEx.Write(ex.Message);
                if (ex.Message.Contains("ORA-03135"))
                {
                    return DatabaseExcuteByXmlHelper.NewInstance.GetObjectsByXml<WCS_TO_WMS>(ConfigFileName, "GetWCS_TO_WMSlistByOrderNO", FLAG, ORDERNO);
                }
                return null;
            }
        }
        //根据周转箱号获取WCS WMS反馈信息
        public List<WCS_TO_WMS> GetWCS_TO_WMSlistByBox(string BoxNO)
        {
            try
            {
                return DatabaseExcuteByXmlHelper.NewInstance.GetObjectsByXml<WCS_TO_WMS>(ConfigFileName, "GetWCS_TO_WMSlistByBoxNOwithoutflag", BoxNO);
            }
            catch (Exception ex)
            {
                MB.Util.TraceEx.Write(ex.Message);
                if (ex.Message.Contains("ORA-03135"))
                {
                    return DatabaseExcuteByXmlHelper.NewInstance.GetObjectsByXml<WCS_TO_WMS>(ConfigFileName, "GetWCS_TO_WMSlistByBoxNOwithoutflag", BoxNO);
                }
                return null;
            }
        }
        //根据周转箱号和状态获取WCS WMS反馈信息
        public List<WCS_TO_WMS> GetWCS_TO_WMSlistByBox(string BoxNO, int FLAG = 0)
        {
            try
            {
                return DatabaseExcuteByXmlHelper.NewInstance.GetObjectsByXml<WCS_TO_WMS>(ConfigFileName, "GetWCS_TO_WMSlistByBoxNO", FLAG, BoxNO);
            }
            catch (Exception ex)
            {
                MB.Util.TraceEx.Write(ex.Message);
                if (ex.Message.Contains("ORA-03135"))
                {
                    return DatabaseExcuteByXmlHelper.NewInstance.GetObjectsByXml<WCS_TO_WMS>(ConfigFileName, "GetWCS_TO_WMSlistByBoxNO", FLAG, BoxNO);
                }
                return null;
            }
        }
        //根据明细序号获取WCS_TO_WMS信息
        public WCS_TO_WMS GetWCS_TO_WMS(string DetailNO)
        {
            try
            {
                return DatabaseExcuteByXmlHelper.NewInstance.GetObjectsByXml<WCS_TO_WMS>(ConfigFileName, "GetWCS_TO_WMSByDetailNO", DetailNO).FirstOrDefault();
            }
            catch (Exception ex)
            {
                MB.Util.TraceEx.Write(ex.Message);
                if (ex.Message.Contains("ORA-03135"))
                {
                    return DatabaseExcuteByXmlHelper.NewInstance.GetObjectsByXml<WCS_TO_WMS>(ConfigFileName, "GetWCS_TO_WMSByDetailNO", DetailNO).FirstOrDefault();
                }
                return null;
            }
        }
        //更新WCS_TO_WMS的Flag完成字段
        //public int UpdateWCS_TO_WMS(int DETAILNO, int Flag)
        //{
        //    int _result = 0;
        //    try
        //    {
        //        _result = MB.RuleBase.Common.DatabaseExcuteByXmlHelper.NewInstance.ExecuteNonQuery(ConfigFileName, "UpdateWCS_TO_WMS_FLAG",Flag, DETAILNO);
        //    }
        //    catch (Exception ex)
        //    {
        //        MB.Util.TraceEx.Write(ex.Message);
        //        if (ex.Message.Contains("ORA-03135"))
        //        {
        //            _result = MB.RuleBase.Common.DatabaseExcuteByXmlHelper.NewInstance.ExecuteNonQuery(ConfigFileName, "UpdateWCS_TO_WMS_FLAG", Flag, DETAILNO);
        //        }
        //    }
        //    return _result;
        //}
        //复核成功后将拣货完成的订单状态置为1-已完成
        public int UpdateWCS_TO_WMS(DbTransaction transaction, int DETAILNO, int Flag)
        {
            int _result = 0;
            try
            {
                _result = MB.RuleBase.Common.DatabaseExcuteByXmlHelper.NewInstance.ExecuteNonQuery(transaction,ConfigFileName, "UpdateWCS_TO_WMS_FLAG", Flag,DETAILNO);
            }
            catch (Exception ex)
            {
                MB.Util.TraceEx.Write(ex.Message);
                if (ex.Message.Contains("ORA-03135"))
                {
                    _result = MB.RuleBase.Common.DatabaseExcuteByXmlHelper.NewInstance.ExecuteNonQuery(transaction, ConfigFileName, "UpdateWCS_TO_WMS_FLAG", Flag, DETAILNO);
                }
            }
            return _result;
        }
        //保存数据到WCS_TO_WMS历史表
        //public int InsertWCSTOWMShistory(List<WCS_TO_WMS> lstWCS_TO_WMS)
        //{
        //    if (lstWCS_TO_WMS == null || lstWCS_TO_WMS.Count <= 0) return 0;

        //    using (MB.RuleBase.BulkCopy.IDbBulkExecute bulk = MB.RuleBase.BulkCopy.DbBulkExecuteFactory.CreateDbBulkExecute())
        //    {
        //        bulk.WriteToServer(ConfigFileName, "InsertWCSWMShistory", lstWCS_TO_WMS);
        //    }

        //    return 1;
        //}

        public int InsertWCSTOWMShistory(DbTransaction transaction, List<WCS_TO_WMS> lstWCS_TO_WMS)
        {
            if (lstWCS_TO_WMS == null || lstWCS_TO_WMS.Count <= 0) return 0;

            using (MB.RuleBase.BulkCopy.IDbBulkExecute bulk = MB.RuleBase.BulkCopy.DbBulkExecuteFactory.CreateDbBulkExecute(transaction))
            {
                bulk.WriteToServer(ConfigFileName, "InsertWCSWMShistory", lstWCS_TO_WMS);
                
            }

            return 1;
        }

        //更新ERP发货订单中的实发商品数量
        //public int UpdateSaleItemQTY(int qty, string GoodsID, string RefSheetID)
        //{
        //    int _result = 0;
        //    try
        //    {
        //        _result = MB.RuleBase.Common.DatabaseExcuteByXmlHelper.NewInstance.ExecuteNonQuery(ConfigFileName, "UpdateSaleItem", qty, GoodsID, RefSheetID);
        //    }
        //    catch (Exception ex)
        //    {
        //        MB.Util.TraceEx.Write(ex.Message);
        //        if (ex.Message.Contains("ORA-03135"))
        //        {
        //            _result = MB.RuleBase.Common.DatabaseExcuteByXmlHelper.NewInstance.ExecuteNonQuery(ConfigFileName, "UpdateSaleItem", qty, GoodsID, RefSheetID);
        //        }
        //    }
        //    return _result;
        //}
        //更新ERP实捡的实捡以及备注信息
        public int UpdateSaleItemQTY(DbTransaction transaction, int qty, string GoodsID, string RefSheetID)
        {
            int _result = 0;
            try
            {
                //_result = MB.RuleBase.Common.DatabaseExcuteByXmlHelper.NewInstance.ExecuteNonQuery(ConfigFileName, "UpdateSaleItem", qty, GoodsID, RefSheetID);
                _result = MB.RuleBase.Common.DatabaseExcuteByXmlHelper.NewInstance.ExecuteNonQuery(transaction, ConfigFileName, "UpdateSaleItem", qty, GoodsID, RefSheetID);
            }
            catch (Exception ex)
            {
                MB.Util.TraceEx.Write(ex.Message);
                if (ex.Message.Contains("ORA-03135"))
                {
                    _result = MB.RuleBase.Common.DatabaseExcuteByXmlHelper.NewInstance.ExecuteNonQuery(transaction, ConfigFileName, "UpdateSaleItem", qty, GoodsID, RefSheetID);
                }
            }
            return _result;
        }

        //更新ERP发货订单中拣货完成时间，备注信息
        //public int UpdateSaleItemQTY(DateTime ptime, DateTime begin_date, string batch_NO, string AREA, string Refsheetid)
        //{
        //    int _result = 0;
        //    string note = "";
        //    note += "开始拣货时间：" + begin_date.ToString() + "-->波次号：" + batch_NO + "-->区域：" + AREA ;
        //    try
        //    {
        //        _result = MB.RuleBase.Common.DatabaseExcuteByXmlHelper.NewInstance.ExecuteNonQuery(ConfigFileName, "UpdateSaleNOTEandPTIME", ptime, note, Refsheetid);
        //    }
        //    catch (Exception ex)
        //    {
        //        MB.Util.TraceEx.Write(ex.Message);
        //        if (ex.Message.Contains("ORA-03135"))
        //        {
        //            _result = MB.RuleBase.Common.DatabaseExcuteByXmlHelper.NewInstance.ExecuteNonQuery(ConfigFileName, "UpdateSaleNOTEandPTIME", ptime, note, Refsheetid);
        //        }
        //    }
        //    return _result;
        //}
        //更新ERP发货订单中拣货完成时间，备注信息
        public int UpdateSaleItemQTY(DbTransaction transaction, DateTime ptime, DateTime begin_date, string batch_NO, string AREA, string Refsheetid)
        {
            int _result = 0;
            string note = "";
            note += "开始拣货时间：" + begin_date.ToString() + "-->波次号：" + batch_NO + "-->区域：" + AREA ;
            try
            {
                _result = MB.RuleBase.Common.DatabaseExcuteByXmlHelper.NewInstance.ExecuteNonQuery(transaction, ConfigFileName, "UpdateSaleNOTEandPTIME", ptime, note, Refsheetid);
            }
            catch (Exception ex)
            {
                MB.Util.TraceEx.Write(ex.Message);
                if (ex.Message.Contains("ORA-03135"))
                {
                    _result = MB.RuleBase.Common.DatabaseExcuteByXmlHelper.NewInstance.ExecuteNonQuery(transaction, ConfigFileName, "UpdateSaleNOTEandPTIME", ptime, note, Refsheetid);
                }
            }
            return _result;
        }
        //保存泡沫箱任务信息
        //public int SendWMS_TO_WCStask( List<WMS_TO_WCS_TASK> list)
        //{
        //    if (list == null || list.Count <= 0) return 0;

        //    using (MB.RuleBase.BulkCopy.IDbBulkExecute bulk = MB.RuleBase.BulkCopy.DbBulkExecuteFactory.CreateDbBulkExecute())
        //    {
        //        bulk.WriteToServer(ConfigFileName, "InsertWMSWCStask", list);

        //    }

        //    return 1;
        //}
        //保存泡沫箱任务信息
        public int SendWMS_TO_WCStask(DbTransaction transaction,List<WMS_TO_WCS_TASK> list)
        {
            if (list == null || list.Count <= 0) return 0;
            foreach (WMS_TO_WCS_TASK taskitem in list)
            {
                MB.Util.TraceEx.Write("订单号：" + taskitem.ORDERNO + " 发货口：" + taskitem.EXLOCATION + taskitem.EXLOCATIONNAME + " 发货箱：" + taskitem.FBOXNO);
            }
            using (MB.RuleBase.BulkCopy.IDbBulkExecute bulk = MB.RuleBase.BulkCopy.DbBulkExecuteFactory.CreateDbBulkExecute(transaction))
            {
                bulk.WriteToServer(ConfigFileName, "InsertWMSWCStask", list);
                
            }

            return 1;
        }

        public List<WMS_TO_WCS_TASK> getWMS_TO_WCStask(string OrderNO)
        {
            try
            {
                return DatabaseExcuteByXmlHelper.NewInstance.GetObjectsByXml<WMS_TO_WCS_TASK>(ConfigFileName, "GetWMS_TO_WCS_TASKByOrderNO", OrderNO);
            }
            catch (Exception ex)
            {
                MB.Util.TraceEx.Write(ex.Message);
                if (ex.Message.Contains("ORA-03135"))
                {
                    return DatabaseExcuteByXmlHelper.NewInstance.GetObjectsByXml<WMS_TO_WCS_TASK>(ConfigFileName, "GetWMS_TO_WCS_TASKByOrderNO", OrderNO);
                }
                return null;
            }
        }

        public int UpdateWMS_TO_WCStaskFLAGandOrderNO(DbTransaction transaction, int Userid,string UserName,string OrderNO)
        {
            int _result = 0;
            try
            {
                _result = MB.RuleBase.Common.DatabaseExcuteByXmlHelper.NewInstance.ExecuteNonQuery(transaction, ConfigFileName, "UpdateWMS_TO_WCStaskFLAGandOrderNO", Userid, UserName, OrderNO);
            }
            catch (Exception ex)
            {
                MB.Util.TraceEx.Write(ex.Message);
                if (ex.Message.Contains("ORA-03135"))
                {
                    _result = MB.RuleBase.Common.DatabaseExcuteByXmlHelper.NewInstance.ExecuteNonQuery(transaction, ConfigFileName, "UpdateWMS_TO_WCStaskFLAGandOrderNO", Userid, UserName, OrderNO);
                }
            }
            return _result;
        }
        #region  泡沫箱解绑操作
        //根据泡沫箱号获取未解绑任务任务信息
        public WMS_TO_WCS_TASK getWMS_TO_WCStask(string BoxNO,int other1=0)
        {
            try
            {
                return DatabaseExcuteByXmlHelper.NewInstance.GetObjectsByXml<WMS_TO_WCS_TASK>(ConfigFileName, "GetWCS_TO_WMS_TASKbyBoxNO", other1, BoxNO).FirstOrDefault();
            }
            catch (Exception ex)
            {
                MB.Util.TraceEx.Write(ex.Message);
                if (ex.Message.Contains("ORA-03135"))
                {
                    return DatabaseExcuteByXmlHelper.NewInstance.GetObjectsByXml<WMS_TO_WCS_TASK>(ConfigFileName, "GetWCS_TO_WMS_TASKbyBoxNO", other1, BoxNO).FirstOrDefault();
                }
                return null;
            }
        }
        //泡沫箱回收解绑


        public int UpdateWMS_TO_WCS_TASKflag(DbTransaction transaction, string OrderNO, string BoxNO, int UserID, string UserName)
        {
            int _result = 0;
            try
            {
                string other1 = "0";//未绑定标志符
                _result = MB.RuleBase.Common.DatabaseExcuteByXmlHelper.NewInstance.ExecuteNonQuery(transaction, ConfigFileName, "UpdateWMS_TO_WCS_TASK", other1, UserID, UserName, OrderNO, BoxNO);
            }
            catch (Exception ex)
            {
                MB.Util.TraceEx.Write(ex.Message);
                if (ex.Message.Contains("ORA-03135"))
                {
                    string other1 = "0";//未绑定标志符
                    _result = MB.RuleBase.Common.DatabaseExcuteByXmlHelper.NewInstance.ExecuteNonQuery(transaction,ConfigFileName, "UpdateWMS_TO_WCS_TASK", other1, UserID, UserName, OrderNO, BoxNO);
                }
            }
            return _result;
        }
        //泡沫箱解绑后记录历史
        public int InsertWMS_TO_WCS_TASKhistory(DbTransaction transaction, List<WMS_TO_WCS_TASK> list)
        {
            if (list == null || list.Count <= 0) return 0;

            using (MB.RuleBase.BulkCopy.IDbBulkExecute bulk = MB.RuleBase.BulkCopy.DbBulkExecuteFactory.CreateDbBulkExecute(transaction))
            {
                bulk.WriteToServer(ConfigFileName, "InsertWMS_WCS_TASKtaskHIS", list);
                
            }

            return 1;
        }
        #endregion
        //复核周转箱与订单信息异常记录
        //public int WriteRecheckExec(int DetailNO, string OrderNO, string BoxNO, int ExectionType, string ExceptionDes, string UserName,string remark="")
        //{
        //    try
        //    {
        //        MB.RuleBase.Common.DatabaseExcuteByXmlHelper.NewInstance.ExecuteNonQuery(ConfigFileName, "InsertWMSTOWCSexception", DetailNO, OrderNO, BoxNO, ExectionType, ExceptionDes, UserName, remark);
        //    }
        //    catch (Exception ex)
        //    {
        //        MB.Util.TraceEx.Write(ex.Message);
        //        if (ex.Message.Contains("ORA-03135"))
        //        {
        //            MB.RuleBase.Common.DatabaseExcuteByXmlHelper.NewInstance.ExecuteNonQuery(ConfigFileName, "InsertWMSTOWCSexception", DetailNO, OrderNO, BoxNO, ExectionType, ExceptionDes, UserName, remark);
        //        }
        //    }
        //    return 1;
        //}
        //复核周转箱与订单信息异常记录
        public int WriteRecheckExec(DbTransaction transaction, int DetailNO, string OrderNO, string BoxNO, int ExectionType, string ExceptionDes, string UserName, string remark = "",string CheckLocation="99")
        {
            try
            {
                MB.RuleBase.Common.DatabaseExcuteByXmlHelper.NewInstance.ExecuteNonQuery(transaction,ConfigFileName, "InsertWMSTOWCSexception", DetailNO, OrderNO, BoxNO, ExectionType, ExceptionDes, UserName, remark, CheckLocation);
            }
            catch (Exception ex)
            {
                MB.Util.TraceEx.Write(ex.Message);
                if (ex.Message.Contains("ORA-03135"))
                {
                    MB.RuleBase.Common.DatabaseExcuteByXmlHelper.NewInstance.ExecuteNonQuery(transaction, ConfigFileName, "InsertWMSTOWCSexception", DetailNO, OrderNO, BoxNO, ExectionType, ExceptionDes, UserName, remark, CheckLocation);
                }
            }
            return 1;
        }
        ////重新下发拣货任务（带有周转箱号码）
        //public bool ReInsertWMS_TO_WCS(DbTransaction transaction, List<WMS_TO_WCS> lstWMS_TO_WCS)
        //{
        //    try
        //    {
        //        if (lstWMS_TO_WCS == null || lstWMS_TO_WCS.Count <= 0) return false;

        //        using (MB.RuleBase.BulkCopy.IDbBulkExecute bulk = MB.RuleBase.BulkCopy.DbBulkExecuteFactory.CreateDbBulkExecute(transaction))
        //        {
        //            bulk.WriteToServer(ConfigFileName, "ReInsertWMS_TO_WCS", lstWMS_TO_WCS);
        //        }

        //        return true;
        //    }
        //    catch (Exception ex)
        //    {
        //        MB.Util.TraceEx.Write(ex.Message);
        //        return false;
        //    }
        //}


        //根据订单编号获取未捡的订单拣货任务
        public List<WCS_TO_WMS> GetPickOrderInfoByOrderNO(string OrderNO)
        {
            try
            {
                return DatabaseExcuteByXmlHelper.NewInstance.GetObjectsByXml<WCS_TO_WMS>(ConfigFileName, "GetOrderInfoByOrderNo", OrderNO);
            }
            catch (Exception ex)
            {
                MB.Util.TraceEx.Write(ex.Message);
                if (ex.Message.Contains("ORA-03135"))
                {
                    return DatabaseExcuteByXmlHelper.NewInstance.GetObjectsByXml<WCS_TO_WMS>(ConfigFileName, "GetOrderInfoByOrderNo", OrderNO);
                }
                return null;
            }
        }
        //根据用户ID获取用户未捡完订单信息
        public List<WMS_APP_PICK_ORDER> GetPicOrderInfoByUserId(int UserID, int Flag = 0)
        {
            try
            {
                return DatabaseExcuteByXmlHelper.NewInstance.GetObjectsByXml<WMS_APP_PICK_ORDER>(ConfigFileName, "GetPickOrderInfoByUserID", UserID, Flag);
            }
            catch (Exception ex)
            {
                MB.Util.TraceEx.Write(ex.Message);
                if (ex.Message.Contains("ORA-03135"))
                {
                    return DatabaseExcuteByXmlHelper.NewInstance.GetObjectsByXml<WMS_APP_PICK_ORDER>(ConfigFileName, "GetPickOrderInfoByUserID", UserID, Flag);
                }
                return null;
            }
        }
        //根据订单编号获取WMS_APP_PICK_ORDER信息，以供判断是否已处于手机拣货状态
        public List<WMS_APP_PICK_ORDER> GetPicOrderInfoByorderNO(string OrderNO)
        {
            try
            {
                return DatabaseExcuteByXmlHelper.NewInstance.GetObjectsByXml<WMS_APP_PICK_ORDER>(ConfigFileName, "GetPickOrderInfoByOrderNO", OrderNO);
            }
            catch (Exception ex)
            {
                MB.Util.TraceEx.Write(ex.Message);
                if (ex.Message.Contains("ORA-03135"))
                {
                    return DatabaseExcuteByXmlHelper.NewInstance.GetObjectsByXml<WMS_APP_PICK_ORDER>(ConfigFileName, "GetPickOrderInfoByOrderNO", OrderNO);
                }
                return null;
            }
        }
        //将APP拣货信息添加或修改进APP拣货信息表中
        public bool InsertWMS_APP_PICK_ORDER(DbTransaction tran, List<WMS_APP_PICK_ORDER> list)
        {
            try
            {
                if (list == null || list.Count <= 0) return false;
                using (MB.RuleBase.BulkCopy.IDbBulkExecute bulk = MB.RuleBase.BulkCopy.DbBulkExecuteFactory.CreateDbBulkExecute(tran))
                {
                    bulk.WriteToServer(ConfigFileName, "InsertWMS_APP_PICK_ORDER", list);
                }
                return true;
            }
            catch (Exception ex)
            {
                MB.Util.TraceEx.Write(ex.Message);
                if (ex.Message.Contains("ORA-03135"))
                {
                    using (MB.RuleBase.BulkCopy.IDbBulkExecute bulk = MB.RuleBase.BulkCopy.DbBulkExecuteFactory.CreateDbBulkExecute(tran))
                    {
                        bulk.WriteToServer(ConfigFileName, "InsertWMS_APP_PICK_ORDER", list);
                    }
                    return true;
                }
                return false;
            }
        }
        //拣货出错的单子，手机APP拣货完成后将订单状态置为1-已完成，并且更新实捡数量
        public int UpdateWCS_TO_WMS(DbTransaction transaction, int DETAILNO,int Pqty, int Flag)
        {
            int _result = 0;
            try
            {
                _result = MB.RuleBase.Common.DatabaseExcuteByXmlHelper.NewInstance.ExecuteNonQuery(transaction, ConfigFileName, "UpdateWCS_TO_WMS_FLAGandPQTY", Flag, Pqty, DETAILNO);
            }
            catch (Exception ex)
            {
                MB.Util.TraceEx.Write(ex.Message);
                if (ex.Message.Contains("ORA-03135"))
                {
                    _result = MB.RuleBase.Common.DatabaseExcuteByXmlHelper.NewInstance.ExecuteNonQuery(transaction, ConfigFileName, "UpdateWCS_TO_WMS_FLAGandPQTY", Flag, Pqty, DETAILNO);
                }
            }
            return _result;
        }

    }
}

